package com.example.demo.controller;

import com.example.demo.utlis.Result;
import com.example.demo.service.OssService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;


@RestController
@RequestMapping("/eduoss/fileoss")
@CrossOrigin
@Api(tags = "上传头像")
public class OssController {

    @Autowired
    private OssService ossService;

    @PostMapping
    @ApiOperation("上传头像")
    public Result uploadOssFile (MultipartFile file){
        String url = ossService.uploadFileAvatar(file);
        return Result.ok().data("url",url);
    }

}
